package com.ruoyi.web.controller.supervise;

import java.text.SimpleDateFormat;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.supervise.domain.ClParticipateunitperson;
import com.ruoyi.supervise.service.IClParticipateunitpersonService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 施工许可-参与单位人员情况Controller
 * 
 * @author ruoyi
 * @date 2019-10-14
 */
@Controller
@RequestMapping("/supervise/ParticipateUnitPerson")
public class ClParticipateunitpersonController extends BaseController
{
    private String prefix = "supervise/ParticipateUnitPerson";

    @Autowired
    private IClParticipateunitpersonService clParticipateunitpersonService;

    @RequiresPermissions("supervise:ParticipateUnitPerson:view")
    @GetMapping()
    public String ParticipateUnitPerson()
    {
        return prefix + "/ParticipateUnitPerson";
    }

    /**
     * 查询施工许可-参与单位人员情况列表
     */
    @RequiresPermissions("supervise:ParticipateUnitPerson:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(ClParticipateunitperson clParticipateunitperson)
    {
        startPage();
        List<ClParticipateunitperson> list = clParticipateunitpersonService.selectClParticipateunitpersonList(clParticipateunitperson);
        return getDataTable(list);
    }

    /**
     * 导出施工许可-参与单位人员情况列表
     */
    @RequiresPermissions("supervise:ParticipateUnitPerson:export")
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(ClParticipateunitperson clParticipateunitperson)
    {
        List<ClParticipateunitperson> list = clParticipateunitpersonService.selectClParticipateunitpersonList(clParticipateunitperson);
        ExcelUtil<ClParticipateunitperson> util = new ExcelUtil<ClParticipateunitperson>(ClParticipateunitperson.class);
        return util.exportExcel(list, "ParticipateUnitPerson");
    }

    /**
     * 新增施工许可-参与单位人员情况
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存施工许可-参与单位人员情况
     */
    @RequiresPermissions("supervise:ParticipateUnitPerson:add")
    @Log(title = "施工许可-参与单位人员情况", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(ClParticipateunitperson clParticipateunitperson)
    {
        return toAjax(clParticipateunitpersonService.insertClParticipateunitperson(clParticipateunitperson));
    }

    /**
     * 修改施工许可-参与单位人员情况
     */
    @GetMapping("/edit/{guid}")
    public String edit(@PathVariable("guid") String guid, ModelMap mmap)
    {
        ClParticipateunitperson clParticipateunitperson = clParticipateunitpersonService.selectClParticipateunitpersonById(guid);
        mmap.put("clParticipateunitperson", clParticipateunitperson);
        return prefix + "/edit";
    }

    /**
     * 修改保存施工许可-参与单位人员情况
     */
    @RequiresPermissions("supervise:ParticipateUnitPerson:edit")
    @Log(title = "施工许可-参与单位人员情况", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(ClParticipateunitperson clParticipateunitperson)
    {
        return toAjax(clParticipateunitpersonService.updateClParticipateunitperson(clParticipateunitperson));
    }
    
    /**
     * 修改施工许可-参与单位人员情况
     */
    @GetMapping("/detail/{guid}")
    public String detail(@PathVariable("guid") String guid, ModelMap mmap)
    {
        ClParticipateunitperson clParticipateunitperson = clParticipateunitpersonService.selectClParticipateunitpersonById(guid);
        mmap.put("clParticipateunitperson", clParticipateunitperson);
        return prefix + "/detail";
    }

    /**
     * 删除施工许可-参与单位人员情况
     */
    @RequiresPermissions("supervise:ParticipateUnitPerson:remove")
    @Log(title = "施工许可-参与单位人员情况", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(clParticipateunitpersonService.deleteClParticipateunitpersonByIds(ids));
    }
}
